package models

type Auth struct {
	Model
	Username string `json:"username" validate:"required" label:"用户名"`
	Password string `json:"password" validate:"required" label:"密码"`
}

// 校验用户名和密码是否正确
func CheckAuth(username, password string) int {
	var auth Auth
	db.Select("id").Where(Auth{Username: username, Password: password}).First(&auth)

	return auth.ID
}
